<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/9/28
 * Time: 19:02
 */
include "config.php";

if($_SERVER["REQUEST_METHOD"]=="POST"){
//    $file = $_FILES["ufile"];
//    $filePath = "./upload/" . $file["name"];

    if(isset($_POST["uname"])&&isset($_POST["upwd"])){
        $sqlRegister="INSERT INTO userinfo (`u_name`,`u_pwd`) VALUES(?,?);";
        $stmt=$connection->prepare($sqlRegister);
        $stmt->bind_param("ss",$_POST["uname"],$_POST["upwd"]);
        $stmt->execute();
        if($stmt->affected_rows>=1){
            print_r(json_encode(array("status"=>1,"msg"=>"注册成功")));
        }
        else{
            print_r(json_encode(array("status"=>-1,"msg"=>"注册失败")));
        }
        $stmt->close();
        $connection->close();
    }
}else{
    print_r(json_encode(array("status"=>0,"msg"=>"不支持GET请求")));
}